﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="incoming.aspx.cs" Inherits="incoming" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:HiddenField ID="hfCallID" runat="server" />
    <asp:LinkButton ID="btTest" runat="server" />
    <asp:Panel ID="pnTweener" runat="server" style="display:none" CssClass="modalPopup">
        <div class="div-box" style="width:400px;">
            <table width="100%" cellpadding="10" cellspacing="5">
                <tr>
                    <td align="left">
                        <asp:Label ID="lbTweenerCallerInfo" runat="server" />
                    </td>
                    <td align="right">
                        <asp:Label ID="lbTweenerClientInfo" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <asp:Label ID="lbTweenerGreeting" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td align="left">
                        <asp:Button ID="btTakeCall" runat="server" Text="Take Call" />
                    </td>
                    <td align="right">
                        <asp:Button ID="btCancelCall" runat="server" Text="Back to Queue" OnClick="btCancelCall_Click" />
                    </td>
                </tr>
            </table>
        </div>
    </asp:Panel>
    <ajax:ModalPopupExtender ID="mpTweener" runat="server" TargetControlID="btTest" PopupControlID="pnTweener" DropShadow="true" BackgroundCssClass="modalBackground" />
    <div id="container">
        <div id="left">
            <div id="call-info" class="div-box">
                <table width="100%">
                    <tr>
                        <td style="text-align:left">Caller:<asp:Label ID="lbCallerInfo" runat="server" Text="Information not available" /></td>
                        <td style="text-align:right">Client:<asp:Label ID="lbClientInfo" runat="server" />&nbsp;<asp:HyperLink ID="lkClientMessages" runat="server" Target="_blank" /></td>
                    </tr>
                </table>
            </div>
            <div id="greeting" class="div-box">
                <asp:Label ID="lbGreeting" runat="server" />
            </div>
            <div id="scratchpad" class="div-box">
                <asp:Label ID="lbScratchpad" runat="server" />
                <asp:ImageButton ID="btEditScratchpad" runat="server" CausesValidation="false"  ImageUrl="~/images/edit.gif" />                
                <ajax:modalpopupextender ID="mpEditScratchpad" runat="server" 
                    PopupControlID="pnEditScratchpad" TargetControlID="btEditScratchpad" BackgroundCssClass="modalBackground" />
            </div>
            <asp:Panel ID="pnEditScratchpad" runat="server" Style="display:none">
                <div style="background-color:#CCCCFF; border: solid 1px black; width:300px;">
                    <p style="text-align:center">Edit Scratchpad</p>
                    <asp:TextBox ID="tbEditScratchpad" runat="server" TextMode="MultiLine" Width="97%" />
                    <asp:ImageButton ID="btUpdateScratchpad" runat="server" CausesValidation="false" ImageUrl="~/images/update.gif" OnClick="btUpdateScratchpad_Click" />
                    &nbsp;<asp:ImageButton ID="btCancelEditAScratchpad" runat="server" ImageUrl="~/images/cancel.gif" />                    
                </div>
            </asp:Panel>
            <div id="instructions" class="div-box">
                <asp:Label ID="lbInstructions" runat="server" />
            </div>
            <div id="specific-instructions" class="div-box">
                <asp:DropDownList ID="ddSpecificInstructions" runat="server" Visible="false" AutoPostBack="true" OnSelectedIndexChanged="ddSpecificInstructions_SelectedIndexChanged" />
                <asp:Label ID="lbSpecificInstructions" runat="server" />
            </div>
            <div id="message-input" class="div-box">
                <table width="100%">
                    <tr>
                        <td>
                            <span>Caller Name:</span><asp:TextBox ID="tbCallerName" runat="server" Width="97%" />
                            <asp:RequiredFieldValidator ID="rfCallerName" runat="server" ControlToValidate="tbCallerName" ValidationGroup="vgMessage" />
                        </td>
                        <td>
                            <span>CallerNumber:</span><ew:NumericBox ID="tbCallerNumber" runat="server" Width="97%" MaxLength="10" DecimalPlaces="0" />
                            <asp:RequiredFieldValidator ID="rfCallerNumber" runat="server" ControlToValidate="tbCallerNumber" ValidationGroup="vgMessage" />
                        </td>
                        <td colspan="2">
                            <span>Caller Address:</span><asp:TextBox ID="tbCallerAddress" runat="server" Width="97%" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <asp:TextBox ID="tbMessage" runat="server" TextMode="MultiLine" Width="99%" Height="100px" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="CustomText1_Label" runat="server" CssClass="custom-label" Visible="false" /><br />
                            <asp:TextBox ID="CustomText1" runat="server" CssClass="custom-field" Visible="false" />
                        </td>
                        <td>
                            <asp:Label ID="CustomDateTime1_Label" runat="server" CssClass="custom-label" Visible="false" /><br />
                            <asp:TextBox ID="CustomDateTime1" runat="server" CssClass="custom-field" Visible="false" />
                            <ajax:CalendarExtender ID="ceCustomDateTime1" runat="server" TargetControlID="CustomDateTime1" />
                        </td>
                        <td>
                            <asp:Label ID="CustomNumeric1_Label" runat="server" CssClass="custom-label" Visible="false" /><br />
                            <ew:NumericBox ID="CustomNumeric1" runat="server" CssClass="custom-field" Visible="false" />
                        </td>
                        <td>
                            <asp:Label ID="CustomBit1_Label" runat="server" CssClass="custom-label" Visible="false" />
                            <asp:CheckBox ID="CustomBit1" runat="server" CssClass="custom-field" Visible="false" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="CustomText2_Label" runat="server" CssClass="custom-label" Visible="false" /><br />
                            <asp:TextBox ID="CustomText2" runat="server" CssClass="custom-field" Visible="false" />
                        </td>
                        <td>
                            <asp:Label ID="CustomDateTime2_Label" runat="server" CssClass="custom-label" Visible="false" /><br />
                            <asp:TextBox ID="CustomDateTime2" runat="server" CssClass="custom-field" Visible="false" />
                            <ajax:CalendarExtender ID="ceCustomDateTime2" runat="server" TargetControlID="CustomDateTime2" />
                        </td>
                        <td>
                            <asp:Label ID="CustomNumeric2_Label" runat="server" CssClass="custom-label" Visible="false" /><br />
                            <ew:NumericBox ID="CustomNumeric2" runat="server" CssClass="custom-field" Visible="false" />
                        </td>
                        <td>
                            <asp:Label ID="CustomBit2_Label" runat="server" CssClass="custom-label" Visible="false" />
                            <asp:CheckBox ID="CustomBit2" runat="server" CssClass="custom-field" Visible="false" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <asp:Label ID="CustomText3_Label" runat="server" CssClass="custom-label" Visible="false" /><br />
                            <asp:TextBox ID="CustomText3" runat="server" CssClass="custom-field" Visible="false" />
                        </td>
                        <td>
                            <asp:Label ID="CustomDateTime3_Label" runat="server" CssClass="custom-label" Visible="false" /><br />
                            <asp:TextBox ID="CustomDateTime3" runat="server" CssClass="custom-field" Visible="false" />
                            <ajax:CalendarExtender ID="ceCustomDateTime3" runat="server" TargetControlID="CustomDateTime3" />
                        </td>
                        <td>
                            <asp:Label ID="CustomNumeric3_Label" runat="server" CssClass="custom-label" Visible="false" /><br />
                            <ew:NumericBox ID="CustomNumeric3" runat="server" CssClass="custom-field" Visible="false" />
                        </td>
                        <td>
                            <asp:Label ID="CustomBit3_Label" runat="server" CssClass="custom-label" Visible="false" />
                            <asp:CheckBox ID="CustomBit3" runat="server" CssClass="custom-field" Visible="false" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <asp:ValidationSummary ID="vsMessage" runat="server" ValidationGroup="vgMessage" />
                        </td>
                    </tr>
                </table>
            </div>
            <div id="message-delivery" class="div-box">
                <table width="100%" cellpadding="0" cellspacing="0" border="1">
                    <tr align="center">
                        <td style="width:20%">Email</td>
                        <td style="width:20%">Fax</td>
                        <td style="width:20%">SMS</td>
                        <td style="width:20%">Alpha</td>
                        <td style="width:20%">Numeric</td>
                    </tr>
                    <tr align="center">
                        <td><asp:CheckBoxList ID="cbEmail" runat="server" /></td>
                        <td><asp:CheckBoxList ID="cbFax" runat="server" /></td>
                        <td><asp:CheckBoxList ID="cbSMS" runat="server" /></td>
                        <td><asp:CheckBoxList ID="cbAlpha" runat="server" /></td>
                        <td><asp:CheckBoxList ID="cbNumeric" runat="server" /></td>
                    </tr>
                </table>
                <p style="text-align:center">
                    <asp:Button ID="btSendMessage" runat="server" Text="send message now" OnClick="btSendMessage_Click" />
                    <asp:Button ID="btQueueMessage" runat="server" Text="queue message" OnClick="btQueueMessage_Click" />
                    <asp:Button ID="btPark" runat="server" Text="Park Call" OnClick="btPark_Click" />
                    <asp:Button ID="btCloseNoBill" runat="server" Text="Close(No Bill)" OnClick="btCloseNoBill_Click" />
                </p>
            </div>            
        </div>
        <div id="right">
            <div id="call-action" class="div-box">
                <span>Speed Dial</span><br />
                <asp:ListView ID="lvNumbers" runat="server">
                    <LayoutTemplate>
                        <table runat="server">
                            <tr ID="itemplaceholder" runat="server" />
                        </table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr runat="server">
                            <td>
                                <asp:LinkButton ID="btNumber" runat="server" Text='<%# Eval("Description").ToString() + " " + Eval("Number1").ToString() %>' OnCommand="PhoneLink_Click" CommandName='<%#Eval("Number1") %>' />
                            </td>
                        </tr>                        
                    </ItemTemplate>
                </asp:ListView><br />
                <asp:LinkButton ID="lkVoiceMail" runat="server" Text="Fwd to Voicemail" OnClick="btVoicemail_Click" /><br /><br />
                <span>Website</span><br />
                <asp:Hyperlink ID="lkWebsite" runat="server" />
            </div>
            <div class="div-box">
                <span>Special Functions</span>
                <asp:ImageButton ID="btNewActionTaken" runat="server" CausesValidation="false"  ImageUrl="~/images/add.gif" /><br />
                <asp:ListView ID="lvActionsTaken" runat="server" DataSourceID="dsActionsTaken">
                    <LayoutTemplate>
                        <table runat="server" width="100%">
                            <tr ID="itemplaceholder" runat="server" />
                        </table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr runat="server">
                            <td>
                                <asp:Label ID="lbDescription" runat="server" Text='<%# Eval("Action.Description") %>'  />
                            </td>
                            <td>
                                <asp:Label ID="lbTimestamp" runat="server" Text='<%# Eval("Timestamp") %>' />
                            </td>
                        </tr>                        
                    </ItemTemplate>
                </asp:ListView>
                <ajax:modalpopupextender ID="mpNewActionTaken" runat="server" 
                    PopupControlID="pnNewActionTaken" TargetControlID="btNewActionTaken" CancelControlID="btCancelActionTaken"  />
                <asp:Panel ID="pnNewActionTaken" runat="server" Style="display:none">
                    <div style="background-color:#CCCCFF; border: solid 1px black; width:300px;">
                        <asp:DataList ID="dlActions" runat="server" DataSourceID="dsActions" DataKeyField="ActionID">
                            <ItemTemplate>
                                <asp:Button ID="btChooseAction" runat="server" Text='<%# Eval("Description") %>' CommandName='<%# Eval("ActionID") %>' OnCommand="btChooseAction_Command" />
                                <br />
                            </ItemTemplate>
                        </asp:DataList>
                        <asp:LinqDataSource ID="dsActions" runat="server" ContextTypeName="AnsweringServiceDataContext" TableName="Actions" />
                        <asp:ImageButton ID="btAddActionTaken" runat="server" CausesValidation="false" ImageUrl="~/images/update.gif" />
                        &nbsp;<asp:ImageButton ID="btCancelActionTaken" runat="server" ImageUrl="~/images/cancel.gif" />                    
                    </div>
                </asp:Panel>
                <asp:LinqDataSource ID="dsActionsTaken" runat="server" ContextTypeName="AnsweringServiceDataContext" EnableDelete="True" EnableInsert="True" 
                    TableName="ActionTakens" Where="CallID == @CallID" OnSelecting="LinqDataSource_Selecting" >
                    <WhereParameters>
                        <asp:ControlParameter Name="CallID" ControlID="hfCallID" PropertyName="Value" Type="Int32" />
                    </WhereParameters>
                </asp:LinqDataSource>
            </div>
            <div class="div-box">
                <asp:LinkButton ID="btFollowUp" runat="server" Text="FOLLOW UP" OnClick="btFollowUp_Click" />
            </div>
            <div id="on-call" class="div-box">
                <table width="100%">
                    <tr><td>8:00AM</td><td></td></tr>
                    <tr><td>9:00AM</td><td></td></tr>
                    <tr><td>10:00AM</td><td></td></tr>
                    <tr><td>11:00AM</td><td></td></tr>
                    <tr><td>12:00PM</td><td></td></tr>
                    <tr><td>1:00PM</td><td></td></tr>
                    <tr><td>2:00PM</td><td></td></tr>
                    <tr><td>3:00PM</td><td></td></tr>
                </table>
            </div>
        </div>
    </div>
</asp:Content>
